/*
 * AssignmentOperatorAst.cpp
 *
 *  Created on: 8 Nov 2010
 *      Author: kn308
 */

#include "AssignmentOperatorAst.h"
#include "../Codegen.h"

namespace MAlice
{

AssignmentOperatorAst::AssignmentOperatorAst(VariableAst* lhs,
		ExpressionAst* rhs) :
	mLHS(lhs), mRHS(rhs)
{
}

AssignmentOperatorAst::~AssignmentOperatorAst()
{
}

llvm::Value* AssignmentOperatorAst::generate()
{
	Codegen*g = Codegen::get();
	Builder* builder = g->getBuilder();

	Value* lhs = getLHS()->generate();
	Value* rhs = getRHS()->generate();
	return builder->CreateStore(lhs, rhs, false);
}

}
